#include <iostream>
#include <string>
#include <deque>
#include <algorithm>
using namespace std;
void print(const deque<int> & d)
{
	for (deque<int>::const_iterator i = d.begin(); i != d.end(); ++i)
	{
		cout<<*i<<"\t";
	}cout<<endl;
}
void constructor()
{
	deque<int> d;
	for (int i = 0; i < 10; ++i)
	{
		d.push_back(i);
	}
	print(d);
	deque<int> e(d.begin(), d.end());
	print(e);
	deque<int> f(10, 100);
	print(f);
	deque<int> g(f);
	print(g);
}
void assignment()
{
	deque<int> d;
	for (int i = 0; i < 10; ++i)
	{
		d.push_back(i);
	}
	print(d);
	deque<int> e;
	e = d;
	e.assign(d.begin(), d.end());
	print(e);
	e.assign(10, 100);
	print(e);
	cout<<"e.empty():\t"<<e.empty()<<endl;
	cout<<"e.size():\t"<<e.size()<<endl;
	cout<<"e.resize(15):\t";
	e.resize(15);
	print(e);
	cout<<endl;

	cout<<"e.resize(20, 200):\t";
	e.resize(20, 200);
	print(e);
}
void insert_delete()
{
	deque<int> d;
	d.push_back(10);
	d.push_back(20);
	print(d);
	d.push_front(30);
	print(d);
	d.pop_front();
	print(d);
	d.pop_back();
	print(d);
	d.insert(d.begin(), 1000);
	print(d);
	d.insert(d.begin(), 2, 2000);
	print(d);
	// according to interval insert
	d.insert(d.begin(), d.begin(), d.end());
	print(d);
	d.erase(++(++d.begin()));
	print(d);
	d.clear();
	cout<<"NULL"<<endl;
	print(d);
}
void depositFetch()
{
	deque<int> d;
	d.push_back(10);
	d.push_back(20);
	print(d);
	cout<<"d[1]:"<<d[1]<<endl;
	cout<<"d.at(0):"<<d.at(0)<<endl;
	cout<<d.front()<<endl;
	cout<<d.back()<<endl;
}
void deque_sort()
{
	deque<int> d;
	d.push_back(232);
	d.push_back(332);
	d.push_back(573);
	d.push_back(737);
	d.push_back(964);
	d.push_back(654);
	d.push_back(888);
	d.push_back(496);
	print(d);
	sort(d.begin(), d.end());
	print(d);
}
int main(int argc, char const *argv[])
{
	// constructor();
	// assignment();
	// insert_delete();
	// depositFetch();
	deque_sort();
	return 0;
}